package com.livesource.client.web.sourceCode.testing;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.livesource.client.model.entry.ProjectClass;
import com.livesource.client.web.LiveSourcePage;
import com.livesource.client.web.sourceCode.code.AceGWTEditor;
import com.livesource.client.web.sourceCode.viewOptions.ButtonSourceCode;
import com.livesource.client.web.sourceCode.viewOptions.OptionsIcons;

/**
 * 
 * @UserInterface
 */
public class ButtonViewTestSourceCode extends Button {

	public ButtonViewTestSourceCode(final ProjectClass testClassFile) {

		this.setText("View Test Source Code");

		this.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {

				OptionsIcons.toggledButtons(testClassFile);
				OptionsIcons.buttonSourceCode
						.setHTML(ButtonSourceCode.imagePressed);

				LiveSourcePage.featureVisualizationPanel.clear();

				new AceGWTEditor().showCodeEditor(testClassFile);

			}
		});

	}

}
